package example.demo.controller;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpSession;

@RestController
@RequestMapping("/system/api/session-B")
public class SessionBController {

    // 指的是session不加入到redis
    // http://localhost:8222/dns-b/system/api/session-B/redis-B-no
    @RequestMapping("/redis-B-no")
    public String redisBNoSession() {
        return "系统-B-无session加入到redis";
    }

    // session加入到redis
    // http://localhost:8111/dns-a/system/api/session-A/redis-A-has
    // http://localhost:8222/dns-b/system/api/session-B/redis-B-has
    @RequestMapping("/redis-B-has")
    public String redisBHasSession(HttpSession httpSession) {
        return "系统-B-有session加入到redis" + httpSession.getAttribute("wahaha");
    }
}
